@extends('wx.layout.default')

@section('wx.pheader')
  @include('wx.layout.swiper')
@stop

@section('wx.pbody')

  @foreach($terms as $term)
  <div class="weui-cells">
    <div class="weui-cells__title">{{$term->name}} ({{$term->branch->name}})</div>
    @foreach($term->users as $clase)

      <a href="{{route('wx.my.attachment',$clase->id)}}" class="weui-cell weui-cell_active weui-cell_access weui-cell_link clase_view" data-id="{{$clase->clase->id}}">
        <div class="weui-cell__bd">
          <p>【{{$clase->category->name}}】{{$clase->clase->name}}</p>
        </div>
        <div class="weui-cell__ft">{!! $clase->present()->claseStatus() !!}
        </div>
      </a>

    @endforeach

  </div>
  @endforeach


@stop

@section('javascript')
  <script src="//cdn.bootcss.com/jquery-weui/1.2.1/js/swiper.min.js"></script>
  <script src="//cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.js"></script>
  <script type="text/javascript">
    $(function() {

      $('.clase').on('click', function () {
          var that = $(this);
          var cid = that.data('id');
          var uri = "/memo/" + cid;

          $.get(uri, {
              is_submit:false,
          }, function (data) {
              if (data.status === true) {
                  layer.alert(data.data.memo+'', function(index){
                    layer.close(index);
                  });
              }
          }, 'json').error(function (data) {
              layer.msg(data.responseJSON.message);
          });

      });



      $('.swiper-container').swiper({
        loop: true,
        autoplay: 5000,
        pagination: '.swiper-pagination',
        paginationClickable: true
      });

    });
  </script>
@stop